//引入第三方包
import { createRouter, createWebHashHistory } from "vue-router"

const routes = [
    {
        //路由地址
        path: "/",
        name:'/',
        //对应路由显示组件
        component: () => import("../views/home.vue")
    },
    {
        //路由地址
        path: "/cart/",
        name: 'cart',
        //对应路由显示组件
        component: () => import("@/views/cart.vue")
    },
    {
        //路由地址
        path: "/login",
        name: 'login',
        //对应路由显示组件
        component: () => import("../views/login.vue")
    },
    {
        //路由地址
        path: "/banner",
        name: 'banner',
        //对应路由显示组件
        component: () => import("../views/banner/index.vue"),
        children: [
            {
                //路由地址
                path: "bannerlist",
                name: 'bannerlist',
                //对应路由显示组件
                component: () => import("../views/banner/components/bannerList.vue")
            },
            {
                //路由地址
                path: "addbanner",
                name: 'addbanner',
                //对应路由显示组件
                component: () => import("../views/banner/components/addBanner.vue")
            },
        ]
    },
]

//创建路由实例
const router = createRouter({
    //确定路由模式，当前使用hash模式
    history: createWebHashHistory(),
    //定义路由表
    routes,
})

//导出当前路由实例
export default router